#!/usr/bin/perl -w

# This code snippet has been taken from the openldap package
use strict;
use Debian::Debhelper::Dh_Lib;

init();

foreach my $package (@{$dh{DOPACKAGES}}) {
	my $tmp=tmpdir($package);
	my $ext=pkgext($package);

	if (! -d "$tmp/DEBIAN") {
		next;
	}

	foreach my $file (qw{preinst postinst postrm config}) {
		my $f="$tmp/DEBIAN/$file";
		if ($f) {
			complex_doit("perl -pe 's~#SCRIPTSCOMMON#~qx{cat debian/${ext}scripts-common}~eg' -i $f");
		}
	}
}
